﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace YemekteyizLib.Bs
{
   public class GrupTurProvider
    {
       public static GrupTur GetById (int id)
       {
       SqlCommand cmd = new SqlCommand("select * from grupTurler GrupID=@ID");
           cmd.Parameters.AddWithValue("@ID", id);

           cmd.Connection = Tools.GetConnection();

           SqlDataReader rdr = cmd.ExecuteReader();

           GrupTur g = new GrupTur();

           if (rdr.HasRows)
           {
               rdr.Read();
               g.ID = id;
               g.Adi = rdr.GetString(2);
               g.Sirasi = rdr.GetInt32(3);
               g.AktifMi = rdr.GetBoolean(4);
               
           }


           Tools.CloseConnection();
           return g;
       }

    }
}
